{% extends "base.html" %}
{% load static %}

{% block title %}
    Assitant Dashboard | {{ block.super }}
{% endblock title %}

{% block content %}

      {% include "_ta_sidebar.html" %}

  <!--main content start-->
  <section id="main-content">

     <section class="wrapper">

        <div class="panel panel-default">

              <div class="panel-heading">
                 {{ view.section_title }}
              </div>

              <div class="row w3-res-tb">
                 <div class="col-sm-2 m-b-xs">
                  <select class="input-sm form-control w-sm inline v-middle js-filter-sel" data-filter-name="status">
                    <option value="clean">Status All</option>
                    <option value="TODO">TODO</option>
                    <option value="DONING">DOING</option>
                    <option value="DONE">DONE</option>
                  </select>
                 </div>

                 <div class="col-sm-2 m-b-xs">
                  <select class="input-sm form-control w-sm inline v-middle js-filter-sel" data-filter-name="ttype">
                    <option value="clean">Type All</option>
                    <option value="exam_paper">EXAM</option>
                    <option value="interview">INTERVIEW</option>
                    <option value="resume">RESUME</option>
                  </select>
                 </div>

                 <div class="col-sm-5">
                 </div>

                 <div class="col-sm-3">
                    {% include "_search_form.html" %}
                 </div>
              </div>

              {% if view.task_list %}
              <div class="table-responsive">
                <table class="table table-striped b-t b-light">
                  <thead>
                    <tr>
                    {% if view.as_assignee %}
                      <th>Assignor</th>
                    {% else %}
                      <th>Assignee</th>
                    {% endif %}
                      <th>Type</th>
                      <th>Student</th>
                      <th>Status</th>
                      <th>Operation</th>
                    </tr>
                  </thead>
                  <tbody>
                    {% for task in view.task_list %}
                      <tr id="tr-{{ task.id }}">
                      {% if view.as_assignee %}
                        <td>{{ task.assignor }}</td>
                      {% else %}
                        <td>{{ task.assignee }}</td>
                      {% endif %}
                        <td>{{ task.ttype }}</td>
                        <td>{{ task.student.username }}</td>
                        <td class="status">{{ task.status }}</td>
                        <td>
                          <a type="button" class="btn btn-primary" href="{{ task.process_url }}">details</a>
                          {% if view.as_assignee %}
                            <button data-task_id="{{ task.id }}" type="button" class="btn btn-primary finish-task">mark as done</button>
                          {% else %}
                            <button data-task_id="{{ task.id }}" type="button" class="btn btn-primary delete-task">delete</button>
                          {% endif %}
                        </td>
                      </tr>
                    {% endfor %}
                  </tbody>
                </table>

              </div>

              <footer class="panel-footer">

                {% include "_pagination.html" %}

              </footer>

              {% else %}
                <div class="well">No tasks yet.</div>
              {% endif %}

        </div>

     </section>

  </section>

  {% include "_footer.html" %}

{% endblock content %}

{% block javascripts %}
    {{ block.super }}
    <script type="text/javascript" src="{% static "laioffer/js/csrf.js" %}"></script>
    <script type="text/javascript" src="{% static "js/laioffer/vendor/url.min.js" %}"></script>
    <script type="text/javascript" src="{% static "js/laioffer/task_list.js" %}"></script>
    </script>
{% endblock javascripts %}